cc.Class({
    extends: cc.Component,

    properties: {
        mgr: cc.Node,
        box: cc.Prefab
    },

    onLoad () {
        this.init();
    },

    init () {
        for (let i = -1; i <= 1; i++) {
            for (let j = -60; j <= 10; j++) {
                let b = cc.instantiate(this.box);
                this.mgr.addChild(b);
                b.x = 110 * i;
                b.z = 150 * j;
                b.y = -50;
            }
        }
    },

    update (dt) {
        this.mgr.z += 500 * dt;
        if (this.mgr.z > 300) {
            this.mgr.z = 0;
        }
    }

});
